namespace ImapComponent.Net.Mail.Imap4
{
    using System;

    /// <summary>
    /// Represents the specific error sent from the server.
    /// </summary>
    public class ImapSimpleServerException : Exception
    {
        #region Constructors

        /// <summary>
        /// Initializes a new instance of the ImapSimpleServerException class.
        /// </summary>
        /// <param name="message">The server exception message.</param>
        public ImapSimpleServerException(string message)
            : base(message)
        {
        }

        #endregion // Constructors
    }


    /// <summary>
    /// Represents a specific error sent from the server
    /// with the client exception message.
    /// </summary>
    public abstract class ImapServerException : ImapSimpleServerException
    {
        #region Fields

        private readonly string clientMessage;

        #endregion // Fields

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the ImapServerException class.
        /// </summary>
        /// <param name="clientMessage">The client exception message.</param>
        /// <param name="serverMessage">The server exception message.</param>
        public ImapServerException(string clientMessage, string serverMessage)
            : base(serverMessage)
        {
            this.clientMessage = clientMessage;
        }

        #endregion // Constructors

        #region Properties

        /// <summary>
        /// Gets the client exception message.
        /// </summary>
        public string ClientMessage
        {
            get
            {
                return this.clientMessage;
            }
        }

        #endregion // Properties
    }

    /// <summary>
    /// Represents a specific server no result exception.
    /// </summary>
    public class ImapServerNoException : ImapServerException
    {
        #region Constructors

        /// <summary>
        /// Initializes a new instance of the ImapServerNoException class.
        /// </summary>
        /// <param name="clientMessage">The client exception message.</param>
        /// <param name="serverMessage">The server exception message.</param>
        public ImapServerNoException(string clientMessage, string serverMessage)
            : base(clientMessage, serverMessage)
        {
        }

        #endregion // Constructors
    }

    /// <summary>
    /// Represents an invalid command result exception.
    /// </summary>
    public class ImapServerBadException : ImapServerException
    {
        #region Constructors

        /// <summary>
        /// Initializes a new instance of the ImapServerBadException class.
        /// </summary>
        /// <param name="clientMessage">The client exception message.</param>
        /// <param name="serverMessage">The server exception message.</param>
        public ImapServerBadException(string clientMessage, string serverMessage)
            : base(clientMessage, serverMessage)
        {
        }

        #endregion // Constructors
    }
}